/* 
 * @Title        (����):KrimaryId.java  
 * @Description  (���):
 * @author       (����):�̴��
 * @data         (ʱ��):2018��8��11�� ����9:20:52 
 * @version:  V1.0 
 */

package com.spc.util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 *  @Title        : KrimaryId.java
 *  @author       :�̴��
 *  @Description  :  �Զ���������id
 *  @date         :2018��8��11��
 */
public class PrimaryId {
	
	private static String key="";
	public static String keyId(){
		Date  date=new Date(GetDate.getNetworkDate());
		// ���ɵ�ǰ����
		SimpleDateFormat format=new SimpleDateFormat("yyyyMMddHHmmss");
		key=format.format(date);
		//  �����
		key+=new Random().nextInt(1000);
//		System.out.println(new Random().nextInt(1000));
//		System.out.println(key);
        try {
			MessageDigest md=MessageDigest.getInstance("MD5");
			md.update(key.getBytes());
			return new BigInteger(1,md.digest()).toString(16);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return key;
	}
	
	public static void main(String[] args) {
		System.out.println(keyId());
	}
}
